package com.xbongbong.pro.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author shian
 * @create 2020-01-02 11:13
 * @Description
 */
@Getter
public enum ModuleAppLabelTypeEnum {
    /**
     * 应用的标签类型
     */
    LIMITE_FREE("enum.moduleAppLabelType.name.limite_free", "limiteFree", 1),
    HOT("enum.moduleAppLabelType.name.hot", "hot", 2);

    private String name;

    private String alias;

    private Integer type;

    ModuleAppLabelTypeEnum(String name, String alias, Integer type) {
        this.name = name;
        this.alias = alias;
        this.type = type;
    }

    public static String getByType(Integer labelType) {
        for (ModuleAppLabelTypeEnum typeEnum : values()) {
            if (Objects.equals(labelType, typeEnum.getType())) {
                return typeEnum.getName();
            }
        }
        return "";
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
